package com.demo.pattern.single;

// 饿汉式 静态变量
public class DemoTest1 {
    public static void main(String[] args) {
        Single1.getInstance();
    }
}


class Single1 {
    // 私有构造方法，外部不能new
    private Single1() {
    }

    public final static Single1 instance = new Single1();

    public static Single1 getInstance() {
        return instance;
    }
}